package com.example.hw_smart_home.huawei_api.product;

import com.example.hw_smart_home.huawei_api.auth.Authentication;
import com.example.hw_smart_home.huawei_api.util.Constants;
import com.example.hw_smart_home.huawei_api.util.HttpUtils;

import java.io.IOException;
import java.net.URISyntaxException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;

public class QueryProductList {

    public static void main(String[] args) throws NoSuchAlgorithmException, KeyManagementException, IOException, URISyntaxException {
        String token = Authentication.getToken();

        String url = Constants.PRODUCT_COMMAND_URL;
        String project_id = Constants.PROJECT_ID_LT;
        url = String.format(url, project_id);

        Map<String, String> headers = new HashMap<>();
        headers.put("Content-Type", "application/json");
        headers.put("X-Auth-Token", token);

        HttpUtils httpUtils = new HttpUtils();
        String responseBody = httpUtils.doGetWithHeaders(url, headers, null);

        System.out.println("响应内容：");
        System.out.println(responseBody);
    }
}
